﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json;

public partial class data_GetCategoryDescriptionByName : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["Category"] == null)
        {
            IList<Category> categoryList = CategoryService.GetInstance().GetCategoryList();
            string returnvalue = JsonConvert.SerializeObject(categoryList);
            Response.Write(returnvalue);
        }
        else
        {
            Category category = null;
            category = CategoryService.GetInstance().GetCategoryByName(Request["Category"].ToString());

            if (category == null)
                return;
            string returnvalue = JsonConvert.SerializeObject(category);
            Response.Write(returnvalue);
        }
    }
}
